<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    const str1 = 'aaa=bbb&cc=dd&ee=ff'
    // const arr = []

    // function fn(str) {
     
    // }
    // fn(str1)
    String.prototype.query = function(str){
      arr = str1.split('&')
      console.log(arr);
      let obj ={}
      arr.forEach( item => {
        crr = item.split('=')
        console.log(crr);
        console.log(crr[0]);
        console.log(crr[1]);
        obj[crr[0]] = crr[1]
        console.log(obj);
      })
    }
    str1.query()
    console.log(String.prototype);
    // function fn (str){
    //   const str2 = str.slice(1)
    //   const arr = []
    //   arr = str2.split('&')
    //   const obj = {}
    //   // arr.forEach(function(item){

    //   // })
    //   arr.forEach( item => {
        
    //   })
    // }

  </script>
</body>
</html>